package com.ss.android.article.base.feature.f.a;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;

import com.ss.android.article.base.feature.f.f;
import com.ss.android.common.applog.AppLog;

public abstract class a extends com.ss.android.article.base.feature.f.a.b {
    public boolean a;
    private f r;
    private String s;

    public a(Context arg2) {
        super(arg2);
        this.s = "";
    }

    public final void a(int arg4, Exception arg5) {
        super.a(arg4, arg5);
        f v1 = this.r;
        int v0 = -1;
        switch (arg4) {
            case 100: {
                v0 = 1004;
                break;
            }
            case 101: {
                v0 = 1005;
                break;
            }
            case 102: {
                v0 = 1006;
                break;
            }
            case 103: {
                v0 = 1009;
                break;
            }
            case 104: {
                v0 = 1003;
                break;
            }
            case 105: {
                v0 = 1008;
                break;
            }
            case 106: {
                v0 = 1007;
                break;
            }
            case 107: {
                v0 = 1001;
                break;
            }
            case 109: {
                v0 = 1002;
                break;
            }
        }

        if (v1.c != null) {
            try {
                if (v1.c("vt")) {
                    v0 += 5000;
                }

                v1.c.put("errt", v0);
            } catch (Exception v0_1) {
            }
        }
    }

    public final void a(int arg6, String arg7, long arg8, String arg10, int arg11, long arg12) {
        this.r = new f(this.n(), this.c, this.c(), this.p());
        super.a(arg6, arg7, arg8, arg10, arg11, arg12);
    }

    public final void a(long arg4) {
        super.a(arg4);
        f v0 = this.r;
        if (!v0.e) {
            v0.d();
        }

        if (arg4 >= 90) {
            this.r.b("bft");
        }
    }

    protected final void a(Bundle arg7) {
        super.a(arg7);
        this.r.a(arg7.getString("url"), arg7.getString("error1"), "", arg7.getString("data_error1"), "");
    }

    protected final void a(Bundle arg3, Object arg4) {
        super.a(arg3, arg4);
        this.r.b("at");
    }

    public final void a(String arg2) {
        super.a(arg2);
        this.r.d(arg2);
    }

    public final void a(String arg6, boolean arg7) {
        this.r = new f(this.n(), this.c, this.c(), this.p());
        super.a(arg6, arg7);
        this.a = false;
        this.s = System.currentTimeMillis() + "_" + AppLog.deviceId();
        this.r.a("ad_exist", 0);
        this.r.a("type", 65537);
        this.r.a(this.s);
    }

    public final void b(int arg3, int arg4) {
        super.b(arg3, arg4);
        f v0 = this.r;
        if (arg3 == 701) {
            ++v0.d;
        } else if (v0.e) {
            if (arg3 != 702 && arg3 != 3) {
                return;
            }

            v0.d();
        }
    }

    protected final void b(Bundle arg7) {
        super.b(arg7);
        this.r.a(arg7.getString("url"), arg7.getString("error1"), arg7.getString("error2"), arg7.getString("data_error1"), arg7.getString("data_error2"));
        this.r.e();
    }

    private String c() {
        String v0 = ((com.ss.android.article.base.feature.f.b.a)this.j).c() == 0 ? "1.0" : "2.0";
        return v0;
    }

    public final void c(int arg6, int arg7) {
        int v0;
        super.c(arg6, arg7);
        switch (arg6) {
            case 200: {
                this.r.a("video_error_what", "video state error: " + arg6);
                return;
            }
        }

        this.r.a("video_error_what", Integer.valueOf(arg7));
        this.r.a("video_error_extra", Integer.valueOf(arg7));
        f v1 = this.r;
        switch (arg6) {
            case -3648: {
                v0 = 2007;
                break;
            }
            case -1106: {
                v0 = 2008;
                break;
            }
            case -1011: {
                v0 = 2004;
                break;
            }
            case -1008: {
                v0 = 2009;
                break;
            }
            case -1007: {
                v0 = 2012;
                break;
            }
            case -1004: {
                v0 = 2003;
                break;
            }
            case -110: {
                v0 = 2006;
                break;
            }
            case -101: {
                v0 = 2005;
                break;
            }
            case -38: {
                v0 = 2001;
                break;
            }
            case -19: {
                v0 = 2002;
                break;
            }
            case -1: {
                v0 = 2010;
                break;
            }
            case 48: {
                v0 = 2011;
                break;
            }
            default: {
                v0 = 1000;
                break;
            }
        }

        if (v1.c == null) {
            return;
        }

        try {
            if (v1.c("vt")) {
                v0 += 5000;
                v1.c.put("br", 1);
            }

            v1.c.put("errt", v0);
        } catch (Exception v0_1) {
        }

        return;
    }

    public void d() {
        super.d();
        this.a = true;
        if (this.i.a() - this.i.b() > 2000) {
            f v0 = this.r;
            if (v0.c != null) {
                try {
                    if (!v0.c("vt")) {
                    }else {
                        v0.c.put("br", 1);
                    }
                } catch (Exception v0_1) {
                }
            }

            this.r.c();
        }

        this.r.c();
    }

    public final void e() {
        super.e();
        this.a = false;
    }

    protected final String f() {
        long v2 = 0;
        String v4 = super.f();
        if (!TextUtils.isEmpty(((CharSequence) v4))) {
            this.r.b();
            f v5 = this.r;
            String v6 = this.c;
            String v7 = this.c();
            String v8 = this.p();
            long v0 = v5.c == null ? v2 : v5.c.optLong("pt");
            v5.a();
            v5.e();
            v5.d = -1;
            v5.c = null;
            v5.g = false;
            v5.a(v6, v7, v8);
            v5.d(v4);
            v5.a(v5.f);
            if (v5.c == null) {
                return v4;
            }

            if (v0 <= v2) {
                return v4;
            }

            com.ss.android.article.base.feature.f.f.a(v5.c, "retry_pt", Long.valueOf(v0));
        }

        return v4;
    }

    public final void g() {
        super.g();
        if (!android.support.design.a.isTextEmpty(this.c)) {
            this.r.a(this.a);
        }
    }

    protected final void h() {
        super.h();
        this.r.b();
        this.r.a();
        this.r.a(this.a);
    }

    private String p() {
        String v0;
        String v1 = "";
        switch (((com.ss.android.article.base.feature.f.b.a)this.j).c()) {
            case 0: {
                v0 = "0";
                break;
            }
            case 1: {
                v0 = "-1";
                break;
            }
            default: {
                v0 = v1;
                break;
            }
        }

        return v0;
    }
}

